<?php if($_SESSION['config_template']=='layoutmain_web1') {?>
<div style="clear:both;"></div>
<div class="top_box"><span></span></div>
<?php if(!count($_SESSION["Cart"])) { ?>
<div class="box base-mini mini-cart">
	<div class="head">
		<h4><?php echo $title; ?>
			<?php if(isset($login)&& $login =="1" && isset($permission) && $permission=="true")  {?>
			<div style="float: right; margin-right:10px">
				<!-- Tạo cây bút chì cho click and change -->
				<ul class="gallery clearfix">
					<a href="/cartsidebar/clickchange?iframe=true&width=370&height=230" rel="prettyPhoto[iframe]">
						<img src="/images/Pencil.png" style="width:20px ; height:20px; margin-top:-4px;"></img>
					</a>
				</ul>			
				<!-- End - Tạo cây bút chì cho click and change -->
			</div>
			<?php  }?>
			
		</h4>
		<div class="addcart_box">
		
		</div>
	</div>
<!-- Content khi ko co san pham-->
	<div class="middle_box">
	
					<div class="content"><p><?php echo $textYourCart; ?>&nbsp;<?php echo $textEmpty; ?></p></div>
	</div>

<!-- end content -->
	<div class="bottom_box"><span></span></div>
</div>
<?php } else  {?>
<div class="box base-mini mini-cart">
	<div class="head">
		<h4><?php echo $title; ?>
		<?php if(isset($login)&& $login =="1" && isset($permission) && $permission=="true")  {?>
		<div style="float: right; margin-right:10px">
			<!-- Tạo cây bút chì cho click and change -->
			<ul class="gallery clearfix">
				<a href="/cartsidebar/clickchange?iframe=true&width=370&height=230" rel="prettyPhoto[iframe]">
					<img src="/images/Pencil.png" style="width:20px ; height:20px; margin-top:-4px;"></img>
				</a>
			</ul>			
			<!-- End - Tạo cây bút chì cho click and change -->
		</div>
		<?php  }?>
		
		</h4>
		<div class="addcart_box">
				<?php 
					$cartSubtotal=0;
					for ($i=0;$i<count($product_list);$i++) {
						$cartSubtotal+=$product_price[$i]*$product_list[$i]['price'];
						$no+=$product_price[$i];
					}
				?>
				<?php echo $textThereAre; ?>&nbsp;<a href="/cart/index"><strong><?php echo $no; ?>&nbsp;<?php echo $textItems; ?></strong></a> <?php echo $textInYourCart; ?>
				<p class="subtotal">
				
				<?php echo $textCartSubtotal; ?> <strong><span class="price">$<?php echo number_format($cartSubtotal); ?></span></strong>
				</p>	
				<div class="" style="clear:both;float:right">
					<button class="form-button" type="button" onclick="setLocation('/cart/index')">
						<span><?php echo $textCheckout;?></span>
					</button>
				</div>
				<div style="clear:both"></div>			
		</div>
		
	</div>
	<div class="middle_box">
			<div class="actions">
				
			</div>
			<h5><?php echo $textRecentlyAdd; ?></h5>
			<ol id="cart-sidebar">
				<?php for ($i=0;$i<count($product_list);$i++) { ?>
				<li class="last odd">
					<div class="product-images">
						<a href="/index/detail?id=<?php echo $product_list[$i]['thing_id']; ?>"><img width="50" height="50" alt="" src="<?php echo $product_list[$i]['avatar']; ?>"></a>
					</div>
					<div class="product-details">
					
						<a href="/index/detail?id=<?php echo $product_list[$i]['thing_id']; ?>">
							<?php
								$kt=strlen($product_list[$i]['title']);
								if ($kt<=14)  
									echo $product_list[$i]['title']; 
								else 
									echo substr($product_list[$i]['title'], 0,13)."..";
							?>
						</a><br>
						<strong><?php echo $product_price[$i] ?></strong> x
						<span class="price">$<?php echo number_format($product_list[$i]['price']) ?></span>                    
						<!-- item custom options -->
					</div>
				</li>
				<?php } ?>
			</ol>

	</div>
	<div class="bottom_box"><span></span></div>
</div>
<?php } ?>
<div style="clear:both;"></div>
<?php } else if($_SESSION['config_template']=='layoutmain_web2') { ?>
<?php if(!count($_SESSION["Cart"])) { ?>
<div class="top_box"><span> </span></div>
<div class="box base-mini mini-cart">
		<div class="head">
			<h4><?php echo $title; ?>
			<?php if(isset($login)&& $login =="1" && isset($permission) && $permission=="true")  {?>
			<div style="float: right; margin-right:10px">
				<!-- Tạo cây bút chì cho click and change -->
				<ul class="gallery clearfix">
					<a href="/cartsidebar/clickchange?iframe=true&width=370&height=230" rel="prettyPhoto[iframe]">
						<img src="/images/Pencil.png" style="width:20px ; height:20px; margin-top:-4px;"></img>
					</a>
				</ul>			
				<!-- End - Tạo cây bút chì cho click and change -->
			</div>
			<?php  }?>
			</h4>
		</div>
		<div class="content">
			<p><?php echo $textYourCart; ?>&nbsp;<?php echo $textEmpty; ?></p>
		</div>
	</div>
	<div class="bottom_box"><span> </span></div>
<?php } else  {?>
<div class="top_box"><span> </span></div>
<div class="box base-mini mini-cart">
		<div class="head">
			<h4><?php echo $title; ?>
			<?php if(isset($login)&& $login =="1" && isset($permission) && $permission=="true")  {?>
			<div style="float: right; margin-right:10px">
				<!-- Tạo cây bút chì cho click and change -->
				<ul class="gallery clearfix">
					<a href="/cartsidebar/clickchange?iframe=true&width=370&height=230" rel="prettyPhoto[iframe]">
						<img src="/images/Pencil.png" style="width:20px ; height:20px; margin-top:-4px;"></img>
					</a>
				</ul>			
				<!-- End - Tạo cây bút chì cho click and change -->
			</div>
			<?php  }?>
				<?php 
					$cartSubtotal=0;
					for ($i=0;$i<count($product_list);$i++) {
						$cartSubtotal+=$product_price[$i]*$product_list[$i]['price'];
						$no+=$product_price[$i];
					}
				?>
			</h4>
			<?php echo $textThereAre; ?>&nbsp;<a href="/cart/index"><strong><?php echo $no; ?>&nbsp;<?php echo $textItems; ?></strong></a> <?php echo $textInYourCart; ?>
				
			<p class="subtotal"><?php echo $textCartSubtotal; ?> <strong><span class="price">$<?php echo number_format($cartSubtotal); ?></span></strong></p>
		</div>

		<div class="actions">
			<button class="form-button" type="button" onclick="setLocation('/cart/index')">
				<span><?php echo $textCheckout;?></span>
			</button>
		</div>
		
		<h5><?php echo $textRecentlyAdd; ?></h5>
		<ol id="cart-sidebar">
			<?php for ($i=0;$i<count($product_list);$i++) { ?>
				<li class="last odd">
					<div class="product-images">
						<a href="/index/detail?id=<?php echo $product_list[$i]['thing_id']; ?>"><img width="50" height="50" alt="" src="<?php echo $product_list[$i]['avatar']; ?>"></a>
					</div>
					<div class="product-details">
					
						<a href="/index/detail?id=<?php echo $product_list[$i]['thing_id']; ?>">
							<?php
								$kt=strlen($product_list[$i]['title']);
								if ($kt<=14)  
									echo $product_list[$i]['title']; 
								else 
									echo substr($product_list[$i]['title'], 0,13)."..";
							?>
						</a><br>
						<strong><?php echo $product_price[$i] ?></strong> x
						<span class="price">$<?php echo number_format($product_list[$i]['price']) ?></span>                    
						<!-- item custom options -->
					</div>
				</li>
				<?php } ?>       
		</ol>

	</div>
	<div class="bottom_box"><span> </span></div>
	<?php } ?>
	<div style="clear:both;"></div>
<?php } else {?>
				<div id="categories">
					<div class="c_navigator">
						<p class="navi_content"><?php echo $title; ?></p>
						<?php if(isset($login)&& $login =="1" && isset($permission) && $permission=="true")  {?>
						<!-- Tạo cây bút chì cho click and change -->
						<ul class="gallery clearfix">
							<a href="/cartsidebar/clickchange?iframe=true&width=370&height=230" rel="prettyPhoto[iframe]">
								<img src="/images/Pencil.png" style="width:20px ; height:20px;margin-right:5px; margin-top:13px;"></img>
							</a>
						</ul>			
						<!-- End - Tạo cây bút chì cho click and change -->
						<?php  }?>
					</div> 
					<div style="margin-top:30px; margin-left:5px; width:216px; height:auto; background:url('/images/boxcart2.jpg') repeat-y;">
						<div style="float:left;width:30%; margin-left:20px; width:50px;"><img id="cart_image" src="<?php if(count($_SESSION["Cart"])) echo "/images/cartnotempty.jpg"; else echo "/images/cartempty.jpg" ?>" alt="" style="width:40px;"></div>
						<div style="font-size:13px; font-weight:bold"><a style="color:#5f5f5f;text-decoration:underline;" href="/cart/index"><?php echo $textYourCart ?></a></div>
						<div style="font-size:13px; float:right;width:60%;margin-right:10px" id="CartModule"><?php if(!count($_SESSION["Cart"])) echo $textEmpty;
							else
							{
								for ($i=0;$i<count($product_list);$i++)
								{
									$kt=strlen($product_list[$i]['title']);
									if ($kt<=14)  
										echo $product_list[$i]['title']; 
									else 
										echo substr($product_list[$i]['title'], 0,13)."..";
									echo "&nbsp x &nbsp";
									echo $product_price[$i];
									echo "<br>";
							
								}
						} 
						?></div>
						<div style="clear: both; height:20px; background:url('/images/boxcart3.jpg') no-repeat"></div>
					</div>
				</div>
<?php } ?>